<template>
    <el-card class="solving_win">
        <div slot="header" class="clearfix">
            <span>问题处理</span>
            <!--<el-button style="float: right; padding: 3px 0" type="text">取消</el-button>-->
        </div>
        <div>
            <p>参与人：</p>
            <br>

            <el-checkbox v-for="(item,index) in heroInRoom" v-model="heroInRoom[index]['checked']">{{item.uname}}</el-checkbox>
            <br><br>
            <p>备注：</p>
            <br>
            <el-input
                    type="textarea"
                    :autosize="{ minRows: 3, maxRows: 6}"
                    label="备注："
                    placeholder="请输入内容"
                    v-model="content">
            </el-input>
            <br><br>
            <el-radio v-model="isSolved" label="1">已解决问题</el-radio>
            <el-radio v-model="isSolved" label="0">未解决问题</el-radio>
        </div>
        <br><br>
        <el-button size="small" type="primary" @click="handle();">确 定</el-button>
        <el-button size="small" @click="$emit('onCancel')">取 消</el-button>

    </el-card>
</template>

<script>
    import FrmFeService from '../../service/FrmFeService'
    export default {
        name: "SolvingWin",
        props:['reportId'],
        beforeCreate(){
            FrmFeService.getHerosInCurrentRoom().then(resp=>{
                console.log(resp.data.data)
                this.heroInRoom.splice(0,this.heroInRoom.length)
                for(let i=0;i<resp.data.data.length;i++)
                {
                    this.heroInRoom.push(resp.data.data[i])
                }
            })
        },
        data(){
            return{
                isSolved:"1",
                content:"",
                radio:'1',
                heroInRoom:[],
            }
        },
        methods:{
            handle(){
                let app=this
                let heroIds=[]
                for(let i=0;i<this.heroInRoom.length;i++)
                {
                    if(this.heroInRoom[i]['checked'])
                    {
                        heroIds.push(this.heroInRoom[i].id)
                    }
                }


                let action={
                    reportId:this.reportId,
                    remarks:this.content,
                    heros:heroIds,
                    handled:(this.isSolved=="1")
            }
                FrmFeService.handleReport(action).then(resp=>{
                    app.$emit('updateRows')
                })
            }
        }
    }
</script>

<style lang="scss" scoped>
.solving_win{
position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    z-index: 100;
}
</style>